import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooDepartmentsController } from '../../../controllers';
const uctoodepartmentsRouter = new Router();
const departmentsController = new uctooDepartmentsController();

uctoodepartmentsRouter.post('/add', requireUser, departmentsController.add);
uctoodepartmentsRouter.post('/edit', requireUser, rowLevelPermission('uctoo/departments'), departmentsController.edit);
uctoodepartmentsRouter.post('/del', requireUser, rowLevelPermission('uctoo/departments'), departmentsController.delete);

//For getting departments with permission control
uctoodepartmentsRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/departments'), departmentsController.getSingle);
uctoodepartmentsRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/departments'), departmentsController.getMany);
uctoodepartmentsRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/departments'), departmentsController.getMany);

//#endregion AutoCreateCode
export default uctoodepartmentsRouter;
